package com.nit.lab.utils;

import org.springframework.core.io.ClassPathResource;

import java.io.*;
import java.util.Date;

public class Jpython {
    public static String pythonApi (String mmsi, String btime,String etime) {
        Process proc;
        try {
            proc = Runtime.getRuntime().exec("sudo python3 /home/ubuntu/server/ship.py" + " " + mmsi + " " + btime
                    + " " + etime);// 执行py文件 服务器端部署
            proc = Runtime.getRuntime().exec("python .\\src\\main\\resources\\ship.py" + " " + mmsi + " " + btime
            + " " + etime);// 执行py文件
            proc.waitFor();
            return "success";
        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
            return "error";
        }
    }
    public static void main (String[] args) {
//        File directory = new File("./src/main/resources/ship.py");
//        System.out.println(directory.getPath());
    }
}
